package com.csun.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * @ClassName: Role.java
 * @Description:角色实体类
 * @author danjinsong danjingsong@dragonwake.cn
 * @date 2017年2月16日下午2:18:15
 * 
 */
@Entity
@Table(name="t_role")
@SuppressWarnings("serial")
public class Role implements Serializable{

	private Integer roleId;										 //主键Id
	private String roleName;									 //角色名称	
	private List<RoleRole> sonRoles;							 //子角色			
	private List<User> userList;								 //权限列表
	
	//===========================================================//
	public Role() {
		super();
	}
	//===========================================================//
	@Id
	@GeneratedValue(generator="_native")						 //主键生成策略数组
	@GenericGenerator(name="_native",strategy="native") 		 //引用策略数组中的native
	@Column(name = "roleId", length=20)
	public Integer getRoleId() {
		return roleId;
	}
	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}
	@Column(name = "roleName",length = 100)
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	@OneToMany
	@JoinColumn(name="u_roleId")
	public List<User> getUserList() {
		return userList;
	}
	public void setUserList(List<User> userList) {
		this.userList = userList;
	}
	@OneToMany
	@JoinColumn(name="faRoleId")
	public List<RoleRole> getSonRoles() {
		return sonRoles;
	}
	public void setSonRoles(List<RoleRole> sonRoles) {
		this.sonRoles = sonRoles;
	}
	
	
}
